{*
Change logs
Sep 13, 2011 - trungdt- Rewrite this view to fit with new article module
*}
<div class="newsmodule_thanhoc page-news-events">
	{include file="`$smarty.const.BASE`modules/common/views/_permission_icons.tpl"}
{if $moduletitle != ""}<h1>{$moduletitle}</h1>{/if}
	<div id="content-area">
		<div class="view view-news-feeds view-id-news_feeds view-news-feeds view-id-news_feeds ">
			<div class="view-content">
				<div class="item-list">
					<ul>
					{foreach name=a from=$data item=article}
						{assign var=article_found value=0}
						{math equation="x+1" x=$article->rank assign=prev}
						{math equation="x-1" x=$article->rank assign=next}
						<li class="views-row views-row-6 views-row-even views-row-last">  
						{permissions level=$smarty.const.UILEVEL_PERMISSIONS}
						{if $permissions.manage == 1}

						<a href="{link module=articlemodule action=edit_article id=$article->id}" title="{$_TR.alt_edit}">
							<img class="mngmnt_icon" style="border:none;" src="{$smarty.const.ICON_RELATIVE}edit.png" title="{$_TR.alt_edit}" alt="{$_TR.alt_edit}" /></a>
						<a href="{link module=articlemodule action=delete_article id=$article->id}" title="{$_TR.alt_delete}" onclick="return confirm('{$_TR.delete_confirm}');">
							<img class="mngmnt_icon" style="border:none;" src="{$smarty.const.ICON_RELATIVE}delete.png" title="{$_TR.alt_delete}" alt="{$_TR.alt_delete}" /></a>    
						{if $smarty.foreach.a.first == 0}
						<a href="{link module=articlemodule action=rank_switch a=$article->rank b=$prev id=$article->id category_id=$article->category_id}">            
							<img class="mngmnt_icon" style="border:none;" src="{$smarty.const.ICON_RELATIVE}up.png" title="{$_TR.alt_up}" alt="{$_TR.alt_up}" /></a>
						{else}
						<img class="mngmnt_icon" style="border:none;" src="{$smarty.const.ICON_RELATIVE}up.disabled.png" title="{$_TR.alt_up_disabled}" alt="{$_TR.alt_up_disabled}" />
						{/if}

						{if $smarty.foreach.a.last == 0}
						<a href="{link module=articlemodule action=rank_switch a=$next b=$article->rank id=$article->id category_id=$article->category_id}">
							<img class="mngmnt_icon" style="border:none;" src="{$smarty.const.ICON_RELATIVE}down.png" title="{$_TR.alt_down}" alt="{$_TR.alt_down}" /></a>
						{else}
						<img class="mngmnt_icon" style="border:none;" src="{$smarty.const.ICON_RELATIVE}down.disabled.png" title="{$_TR.alt_down_disabled}" alt="{$_TR.alt_down_disabled}" />
						{/if}        
						{/if}
						{/permissions}
						
							<div class="views-field-field-story-image-fid">
								<span class="field-content"><a id="article_{$article->id}" title="{$article->title}" href="{link module=articlemodule action=view_article id=$article->id}" class="imagecache imagecache-front_news_thumb imagecache-linked imagecache-front_news_thumb_linked">
								{if $article->image_path != ""}
								<img src="{$smarty.const.BASE_URL}/phpThumb.php?src={$article->image_path}&w=75&h=75" title="{$article->title}" class="imagecache imagecache-front_news_thumb" width="75" height="75">
								{else}
									<img src="{$smarty.const.THEME_RELATIVE}modules/newsmodule/images/NoImage.gif" title="{$article->title}" class="imagecache imagecache-front_news_thumb" width="75" height="75">
								{/if}
							</a></span>
							</div>
							<div class="views-field-title">
								<span class="field-content"><a id="article_{$article->id}" title="{$article->title}" href="{link module=articlemodule action=view_article id=$article->id}" alt="{$article->title}">{$article->title}</a></span>
							</div>

							<div class="views-field-created">
								<span class="field-content">[{$article->create_date}]</span>
							</div>

							<div class="views-field-body">
								<span class="field-content">
									{if $article->summary != ""}
										{$article->summary}
									{else}
										{$article->body|summarize:"html":"para"}
									{/if}
								</span>
							</div>

							<div class="views-field-view-node" style="text-align: right;">
								<span class="field-content"><a id="article_{$article->id}" title="{$article->title}" href="{link module=articlemodule action=view_article id=$article->id}" alt="{$article->title}">Đọc thêm</a></span>
								{if $article->file_id > 0}
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="field-content"><a id="download_article_{$article->id}" title="{$_TR.download} {$article->title}" href="{$smarty.const.BASE_URL}/download_file.php?id={$article->file_id}&file_name={$article->file_path}" alt="{$_TR.download} {$article->title}">Download file</a></span>
								{/if}
							</div>
						</li>
					{/foreach}
					</ul>
			</div>    </div>
		</div> <!-- /.view -->
	</div>
</div>

{* Paging & Form control *}
{permissions level=$smarty.const.UILEVEL_NORMAL}
	{if $permissions.manage == 1}
	{if $submissions > 0}<a href="{link module=articlemodule action=view_submissions}">You have {$submissions} submitted article{if $submissions > 1}s{/if}</a>{/if}
	<br /><a href="{link module=articlemodule action=edit_article}">{$_TR.new_entry}</a><br />
	{if $config->enable_categories == 1}
		<a href="{link module=articlemodule module=categories action=manage orig_module=articlemodule}">{$_TR.manage_categories}</a>
	{/if}
{/if}

{if $config->allow_submissions == 1}
	{get_user assign=user}
	{if $config->require_login == 0 || $user->id > 0}
		<br><a href="{link module=articlemodule action=submit_article}">Submit an Article</a>
	{/if}
{/if}
{/permissions}
<div align=center style='padding-top: 10px;'>{paging current_page=$page pages=$pages action=view_page module=articlemodule page_length=10 src=$__loc->src}</div>